package org.example.cloudalibaba.controller;

import org.example.springcloud.common.Result;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("config")
@RestController
@RefreshScope
public class ConfigController {
    @Value("${config.info}")
    private String configInfo;

    // 动态获取配置中心配置信息
    // request url: http://localhost:8001/config/info
    @GetMapping("info")
    public Result<?> getConfigInfo() {
        return Result.success("config info:{}", configInfo);
    }
}
